home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Interactive 7
/
PC World Interactive 7.iso
/
program
/
ctutord.EXE
/
STRUCT.C
< prev
next >
Wrap
C/C++ Source or Header
|
1990-09-18
|
725b
|
41 lines
/*
There may be additional include files required depending
upon the compile product you are using. Typical compilers
include Microsoft C by Microsoft or Turbo C by Boland Int'l.
*/
#include <stdio.h>
struct ABC { char a, b, c;
int x, y, z; } ;
struct XYZ { struct ABC a1;
int z1;
struct ABC *p1;
};
main()
{
static struct ABC ttt;
static struct ABC sss;
static struct XYZ q[] = {
{
{ 'h', 'i', 'j', 0, 1, 2 },
1000,
&ttt
},
{
{ 'b', 'y', 'e', 10, 11, 12 },
9000,
&sss
}
};
/* illegal syntax -> q.p1->a = 100; */
q[0].p1->a = 100;
printf("%d\n",q[0].p1->a);
(*q).p1->a = 500;
printf("%d\n",q[0].p1->a);
}